package com.whfc.ms.api.emp.service.impl;

import com.whfc.common.result.ListData;
import com.whfc.common.result.PageData;
import com.whfc.emp.dto.AppEmpCorpDTO;
import com.whfc.emp.dto.AppGroupDTO;
import com.whfc.emp.param.AppEmpGroupAddParam;
import com.whfc.emp.param.AppEmpGroupEditParam;
import com.whfc.emp.service.AppGroupService;
import com.whfc.ms.api.emp.service.MsAppGroupService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClasssName MsAppGroupServiceImpl
 * @Description 人员班组服务
 * @Author hw
 * @Date 2020/12/29 10:32
 * @Version 1.0
 */
@Service
public class MsAppGroupServiceImpl implements MsAppGroupService {

    @DubboReference(interfaceClass = AppGroupService.class, version = "1.0.0", timeout = 5000)
    private AppGroupService appGroupService;

    @Override
    public PageData<AppGroupDTO> list(Integer projectId, Integer pageNum, Integer pageSize, String keyword, Integer corpId) {
        return appGroupService.list(projectId, pageNum, pageSize, keyword, corpId);
    }

    @Override
    public ListData<AppGroupDTO> groupListByCorpId(Integer corpId) {
        List<AppGroupDTO> list = appGroupService.groupListByCorpId(corpId);
        return new ListData<>(list);
    }

    @Override
    public ListData<AppGroupDTO> groupListByProjectId(Integer projectId) {
        List<AppGroupDTO> list = appGroupService.groupListByProjectId(projectId);
        return new ListData<>(list);
    }

    @Override
    public ListData<AppEmpCorpDTO> groupListByDeptId(Integer deptId, String keyword) {
        List<AppEmpCorpDTO> list = appGroupService.groupListByDeptId(deptId,keyword);
        return new ListData<>(list);
    }

    @Override
    public void add(AppEmpGroupAddParam param) {
        appGroupService.add(param);
    }

    @Override
    public void edit(AppEmpGroupEditParam param) {
        appGroupService.edit(param);
    }

    @Override
    public void del(Integer groupId) {
        appGroupService.del(groupId);
    }

    @Override
    public void syncGroup(AppEmpGroupEditParam param) {
        appGroupService.syncGroup(param);
    }

    @Override
    public void syncCropName(Integer deptId) {
        appGroupService.syncCropName(deptId);
    }
}
